package com.my.selectcoursesystem.dao;

import com.my.selectcoursesystem.bean.Course;
import com.my.selectcoursesystem.bean.SelectCourse;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface CourseDao extends JpaRepository<Course, String> {
    List<Course> findAll();
    Course findByCid(String cid);
    List<Course> findAllByCnameContains(String c_name);
    List<Course> findAllByCidContains(String c_id);
    List<Course> findAllByCollegeContains(String college);
    List<Course> findAllByTypeContains(String type);
    List<Course> findAllByTeacherid(String teacher_id);
    Course findByCidAndTeacherid(String cid, String teacherid);
    @Transactional
    void deleteByCidAndTeacherid(String cid, String tid);
}
